<template>
  <div>
    <form action="">
      <hr />
      用户名:<input type="text" v-model="username" /> <br /><br />
      密码:<input type="password" /> <br />
      <button @click="doLogin">登录</button>
    </form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: "",
    };
  },
  methods: {
    doLogin() {
      localStorage.setItem("user", JSON.stringify(this.username));
      this.$router.push("/");
    },
  },
};
</script>

<style>
</style>